package com.sg.business.commons.ui.vault;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

public class EmberedVaultExplorer extends VaultExplorer {

	public EmberedVaultExplorer(Composite parent, int style,
			boolean skipPermission) {
		super(parent, style, skipPermission, true, false);
	}

	@Override
	protected Control createFolderTree(Composite parent) {
		Control control = super.createFolderTree(parent);
		folderExplorer.setPopupMenu("popup:vault.menu.folder");
		return control;
	}

	@Override
	protected Control createDocumentTable(Composite parent) {
		Control control = super.createDocumentTable(parent);
		docViewer.setPopupMenu("popup:vault.menu.doc");
		return control;
	}

	// @Override
	// protected List<Document> displayDocumentByOption(Option option,
	// boolean skipPermission) {
	// List<Document> result = new ArrayList<Document>();
	// List<Folder> root = getRoot();
	// for (int i = 0; i < root.size(); i++) {
	// result.addAll(getDocumentsFromFolder(root.get(i),
	// option.getValue(), skipPermission));
	// }
	// return result;
	// }
	//
	// private Collection<? extends Document> getDocumentsFromFolder(
	// Folder folder, Object value, boolean skipPermission) {
	// List<Document> result = new ArrayList<Document>();
	// List<Document> docs = folder.getDocuments(!skipPermission);
	// for (Document document : docs) {
	// Object docValue = document.getValue(Document.F_DOCUMENT_TYPE);
	// if (Util.equals(docValue, value)) {
	// result.add(document);
	// }
	// }
	//
	// List<PrimaryObject> children = folder.getChildrenFolder();
	// if (children != null) {
	// for (int i = 0; i < children.size(); i++) {
	// Folder childFolder = (Folder) children.get(i);
	// result.addAll(getDocumentsFromFolder(childFolder, value,
	// skipPermission));
	// }
	// }
	//
	// return result;
	// }
	//
	// protected List<Document> getDocumentByKeyword(String keyword,
	// boolean skipPermission) {
	// List<Document> result = new ArrayList<Document>();
	// List<Folder> root = getRoot();
	// for (int i = 0; i < root.size(); i++) {
	// result.addAll(getDocumentsFromSrearch(root.get(i), keyword,
	// skipPermission));
	// }
	// return result;
	// }
	//
	// private Collection<? extends Document> getDocumentsFromSrearch(
	// Folder folder, String keyword, boolean skipPermission) {
	// List<Document> result = new ArrayList<Document>();
	// Pattern pattern = Pattern.compile("^.*" + keyword + ".*$",
	// Pattern.CASE_INSENSITIVE);
	// result.addAll(displayDocumentByCondition(new BasicDBObject().append(
	// Document.F_FOLDER_ID, folder.get_id()).append(Document.F_DESC,
	// pattern),skipPermission));
	// List<PrimaryObject> children = folder.getChildrenFolder();
	// if (children != null) {
	// for (int i = 0; i < children.size(); i++) {
	// Folder childFolder = (Folder) children.get(i);
	// result.addAll(getDocumentsFromSrearch(childFolder, keyword,
	// skipPermission));
	// }
	// }
	//
	// return result;
	// }

}
